package com.chuangke.common.validator;

import java.util.Map;

import org.apache.commons.lang3.ObjectUtils;

import com.chuangke.common.exception.ChuangkeException;

public class CkMapValidator {
	
	private final Map<String,Object> data ;
	
	public CkMapValidator(Map<String, Object> data) {
		this.data = data;
	}

	public static CkMapValidator getInstance(Map<String,Object> data) {
		return new CkMapValidator(data) ;
	}
	
	public CkMapValidator notEmpty(String feild,String errorMessage) {
		Object value =  data.get(feild) ;
		if(ObjectUtils.isEmpty(value)) {
			throw new ChuangkeException(errorMessage) ;
		}
		
		return this ;
	}
}
